import { Client } from "../client/Client";
import { GuildChannelDto } from "./dto/GuildChannel";
import { Snowflake } from "./utils/Snowflake";
import { Guild } from "./Guild";

/*

    channel.type
        0 basic
        2 voice
        4 channels folder
        5 anouncement
        15 topics

*/
export class GuildChannel {
    id!: Snowflake
    type!: number
    position!: number
    name!: string
    last_message_id!: string
    parent_id?: string

    constructor(private client: Client, private guildObj: Guild, dto: GuildChannelDto) {
        this._patch(dto);
    }

    get guild() {
        return this.guildObj
    }

    private _patch(data: GuildChannelDto) {
        this.id = data.id;
        this.type = data.type;
        this.position = data.position;
        this.name = data.name;
        this.last_message_id = data.last_message_id;
        this.parent_id = data.parent_id;
    }
}
